package com.yang.entity.commodityDetail;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.math.BigDecimal;
import java.util.List;

@Data
@Accessors(chain = true)
@Document(collection = "skus")
// 当属性为默认值时，不序列化
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
public class Skus {

    /**
     * 商品sku列表
     */
    @Id
    @JsonIgnore
    private long id; // sku id
    private int skuId; // sku id
    private int commodityId; // 商品id
    public List<Specs> specs; // sku规格列表，包含规格名称和规格值
    private BigDecimal price; // sku价格
    private int stock; // sku库存

    @Override
    public String toString() {
        return "Skus{" +
                "skuId=" + skuId +
                ", commodityId=" + commodityId +
                ", specs=" + specs +
                ", price=" + price +
                ", stock=" + stock +
                '}' + "\n";
    }
}
